SciChart exposes several methods on the SciChartSurface type for capturing and exporting charts:
- Print() — prints the chart as displayed on screen
- ExportToFile(..) — saves the chart to an image file
- ExportToBitmapSource(..) — returns an in-memory bitmap
- ExportToStream(..) — writes a Bitmap to a stream
SciChart supports two main types of export functionality: Export As-Is and Export with Custom Parameters
Export As-Is
For reliable what-you-see-is-what-you-get output at the control’s current size continue reading following section. If you want to change parameters of an exported chart, such as setting specific image resolution or specifying quality options, please read on to the next section "Export with Custom Parameters"
Export a chart to a raster image “As-Is”
To export the chart exactly as it appears on screen — with current size, theme, annotations, cursors, and modifiers, — use the “As-Is” export options. This provides true WYSIWYG (What You See Is What You Get) output in raster formats such as PNG, JPEG, and BMP.
Printing
Opens the system Print Dialog and prints the chart exactly as displayed. You may select a physical printer or virtual devices like “Microsoft Print to PDF” or XPS:
| Printing a Chart |
Copy Code |
|---|---|
// Prints the current on-screen chart “as-is”
sciChartSurface.Print(); | |
Exporting to a Raster Image File
Calling ExportToFile(...) with useXamlRenderSurface: false and no size parameter will save the on-screen chart as a raster image. The file format depends on the exportType parameter (.png, .jpg, .bmp).
| Exporting to a Raster Image File |
Copy Code |
|---|---|
// Exporting to a ‘.png’ file as-is sciChartSurface.ExportToFile("path", Core.ExportType.Png, false); | |
Note: If you want to change parameters of an exported chart - such as setting certain image resolution or specifying quality options - please refer to the next section "Export with Custom Parameters"
Exporting to a BitmapSource
SciChart supports exporting a chart to a WPF BitmapSource (an in-memory bitmap).
This is a convenient way to capture a screenshot of the chart for use in WPF UIs or further image processing.
All variations below result in the same on-screen capture:
| Exporting to a BitmapSource |
Copy Code |
|---|---|
// Capture the current chart as a BitmapSource // All three examples will do the same export as is BitmapSource bitmap1 = sciChartSurface.ExportToBitmapSource(); BitmapSource bitmap2 = sciChartSurface.ExportToBitmapSource(useXamlRenderSurface: false); BitmapSource bitmap3 = sciChartSurface.ExportToBitmapSource(useXamlRenderSurface: false, size: null); | |
Note: If you want to change parameters of an exported chart - such as setting certain image resolution or specifying quality options - please refer to the next section "Export with Custom Parameters"
Copying a Chart to Clipboard
For copying to clipboard, first export a chart to a BitmapSource, then assign it to the Clipboard object:
| Copying a Chart to Clipboard |
Copy Code |
|---|---|
private void CopyToClipboard() { // Export to an in-memory BitmapSource var bmp = sciChartSurface.ExportToBitmapSource(); // Copy the chart image to the Windows Clipboard Clipboard.SetImage(bmp); } | |
Exporting To a Stream
This method writes a raster snapshot of the on-screen chart to a provided stream. Useful for in-memory workflows, custom storage, or returning bytes from APIs:
| Exporting To a Stream |
Copy Code |
|---|---|
Stream myStream = sciChartSurface.ExportToStream(Core.ExportType.Png, false); | |
Note: If you want to change parameters of an exported chart - such as setting certain image resolution or specifying quality options - please refer to the next section "Export with Custom Parameters"
Export with Custom Parameters
SciChart WPF allows exporting charts with custom resolution, quality, and styling. This is done by creating a clone of the chart in memory and rendering it off-screen. Custom exports rely on XML serialization/deserialization of the chart.
This approach is recommended when you need:
- Output at a different resolution or size than an on-screen chart
- Higher quality (vector-style) rendering using
XamlRenderSurface - One-off visual tweaks for exported image (e.g. hiding gridlines, annotations, changing colors, etc.)
It is also possible to export an on-screen chart with custom modifications.
How it works
This export method creates a clone of the chart in memory and renders it off-screen. The process relies on XML serialization of the existing chart, followed by deserialization to generate an in-memory copy. All advanced export scenarios described below are built on top of this mechanism.
However, because it depends on serialization and deserialization, this approach is more nuanced and potentially error-prone compared to simple “as-is” export.
If you encounter any issues during export, please refer to the dedicated Troubleshooting article for guidance.
The most common use cases for this type of export are outlined below, with examples.
Exporting with a Custom Size (Different Resolution)
A chart can be exported at a specific pixel size — independent of its on-screen dimensions -using the following method:
| Exporting to a Custom Size |
Copy Code |
|---|---|
// Export in memory caused by exporting to a size specified by a user sciChart.ExportToFile("path", Core.ExportType.Png, false, new Size(1920, 1080)); | |
Note: Export with parameters relies internally on serialization and deserialization, which may lead to issues with certain chart configurations.
If you encounter any problems during export, please refer to the dedicated Troubleshooting article for guidance.
Exporting Higher-Quality Images Using the XAML Renderer
It is possible to enable the XAML Renderer, which supports vector-style drawing, for export. This results in higher-quality text and sharper, vector-like edges in the resulting raster image. It typically renders more crisply than GPU-based surfaces, though it may come at the cost of performance:
| Exporting using a XAML Renderer |
Copy Code |
|---|---|
// Export in memory caused by 'useXamlRenderSurface = true' // This will use XamlRenderer under the hood sciChart.ExportToFile("path", Core.ExportType.Png, true); | |
You can also export a chart to an image at a specific resolution using the XAML Renderer:
| Exporting using a XAML Renderer to a Custom Size |
Copy Code |
|---|---|
// Export in memory caused by using both 'useXamlRenderSurface = true' and size specified sciChart.ExportToFile("path", Core.ExportType.Png, true, new Size(1920, 1080)); | |
Parameters
- useXamlRenderSurface
Type: bool- true → Uses XamlRenderSurface for higher quality export
- false → Uses the actual or default rendering surface
- exportedSize
Type: Size?- null → Exports using the current chart dimensions or default size.
- Size(width, height) → Exports the chart at the defined resolution.
The same parameters apply to the ExportToBitmapSource() and ExportToStream() methods as well:
| Exporting to a Custom Size |
Copy Code |
|---|---|
Bitmap bmp = sciChart.ExportToBitmapSource(true, new Size(1920, 1080)); Stream myStream = sciChart.ExportToStream(Core.ExportType.Png, true, new Size(1920, 1080)); | |
Note: Export with parameters relies internally on serialization and deserialization, which may lead to issues with certain chart configurations.
If you encounter any problems during export, please refer to the dedicated Troubleshooting article for guidance.
Advanced Export with Chart Customization
It is possible to customize an in-memory copy of a chart by overriding the CreateCloneOfSurfaceInMemory(Size newSize) method.
This allows you to modify the cloned chart before export -- for example, by adding watermarks, changing the theme, or adjusting the visibility of elements. Additionally, this technique can be used to work around export-related issues that may occur during the serialization process.
Minimal override pattern:
| Exporting an in-memory copy of a chart |
Copy Code |
|---|---|
using System.Windows; using SciChart.Charting.Visuals; public class SciChartSurfaceEx : SciChartSurface { // Called by SciChart during clone-based export (custom size, XPS, etc.) protected override SciChartSurfaceBase CreateCloneOfSurfaceInMemory(Size newSize) { // Always start from the default clone logic var clonedSurface = base.CreateCloneOfSurfaceInMemory(newSize); // Change the cloned SciChartSurface here... return clonedSurface; } } | |
Use this as a starting point to modify the cloned SciChartSurface - not the original one.
The following example demonstrates typical use cases for customizing a chart before export:
- Switching the theme for export (e.g., from
SciChartv4DarktoChrome) - Ensuring all data is visible (e.g., by calling
ZoomExtents()before rendering) - Adjusting the appearance or visibility of specific series for export
- Adding watermarks or export-only annotations
The exported chart is modified in code as shown below:
| Customizing a chart before export |
Copy Code |
|---|---|
using System.Linq; using System.Windows; using SciChart.Charting.Themes; using SciChart.Charting.Visuals; using SciChart.Charting.Visuals.Annotations; public class SciChartSurfaceEx : SciChartSurface { protected override SciChartSurfaceBase CreateCloneOfSurfaceInMemory(Size newSize) { // Create the default clone var cloned = (SciChartSurface)base.CreateCloneOfSurfaceInMemory(newSize); // Change theme on the CLONED surface ThemeManager.SetTheme(cloned, "Chrome"); // Apply one-off export styling on the clone // Transparent PNG cloned.Background = Brushes.Transparent; // Hide interactive overlays for export cloned.ChartModifiers.Clear(); // Make axes text larger for readability in output foreach (IAxis axis in clone.XAxes.Concat<IAxis>(clone.YAxes)) { axis.FontSize = Math.Max(axis.FontSize, 14); axis.AxisBandsFill = Brushes.Transparent; } // Emphasize line thickness across the chart foreach (var rs in clone.RenderableSeries) { if (rs is IStrokeRenderableSeries srs) srs.StrokeThickness = Math.Max(2, srs.StrokeThickness); } // Select 1st series if (cloned.RenderableSeries.Count > 0) cloned.RenderableSeries[0].IsSelected = true; // Optional: add a watermark only to the clone // May be useful for docs cloned.Annotations.Add(new TextAnnotation { Text = "Watermark text here!", CoordinateMode = AnnotationCoordinateMode.Relative, X1 = 0.9, Y1 = 0.9, HorizontalAnchorPoint = HorizontalAnchorPoint.Right, VerticalAnchorPoint = VerticalAnchorPoint.Bottom, Opacity = 0.5 }); // Zoom the clone to extents so all data is visible // Useful when you need a zoomed-out chart on a resulted image(or copy) cloned.ZoomExtents(); // Return the modified clone; the original surface remains unchanged return cloned; } } | |
Note: Export with parameters relies internally on serialization and deserialization, which may lead to issues with certain chart configurations.
If you encounter any problems during export, please refer to the dedicated Troubleshooting article for guidance.
Exporting to a Vector Image
Unlike raster formats (e.g., PNG, JPEG, BMP), vector images preserve text, lines, and shapes as scalable vector elements. This ensures that exported charts remain sharp at any zoom level, making them ideal for high-resolution printing or embedding in professional-quality documents.
SciChart WPF supports XPS as the only vector export format. Charts can be exported to XPS files directly using the built-in export functionality.
Export to a Vector Image (XPS)
| Export to XPS |
Copy Code |
|---|---|
// Target export size, or null for current chart size Size? exportedSize = null; // Save the current chart visual to an XPS file // "What you see is what you get": the visible chart will be exported sciChartSurface.ExportToFile("chart-output.xps", ExportType.Xps, true, exportedSize); | |
Notes
- When the
useXamlRenderSurfaceparameter is set tofalse, the export will produce a vector container (XPS) containing a single raster image of the chart.
To generate true vector graphics, you must set this parameter to true, which enables the XAML Renderer — the only renderer in SciChart that supports vector output. - Export with parameters relies internally on serialization and deserialization, which may lead to issues with certain chart configurations.
If you encounter any problems during export, please refer to the dedicated Troubleshooting article for guidance.
Export to PDF
There are three common ways to generate a PDF from a SciChart WPF chart:
- Print to PDF (WYSIWYG, no code changes)
Use the operating system's print dialog with a virtual printer such as “Microsoft Print to PDF”. This method captures and exports the on-screen chart as a raster image, exactly as it appears. - Embed a Raster Image via a PDF Library
Export the chart to a bitmap (optionally off-screen and at higher resolution for better DPI), then insert that image into a PDF document using a third-party PDF tool or library. - Vector Output via XPS to PDF Conversion
Export the chart to XPS format (vector-based), then convert the XPS file to PDF using an external tool. This approach preserves vector quality for text, lines, and shapes, resulting in crisp, scalable output.